accounts-qt  1.16
provider.h
1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /*
3  * This file is part of libaccounts-qt
4  *
5  * Copyright (C) 2009-2011 Nokia Corporation.
6  * Copyright (C) 2012-2016 Canonical Ltd.
7  *
8  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public License
12  * version 2.1 as published by the Free Software Foundation.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22  * 02110-1301 USA
23  */
29 #ifndef ACCOUNTS_PROVIDER_H
30 #define ACCOUNTS_PROVIDER_H
31 
32 #include "Accounts/accountscommon.h"
33 
34 #include <QStringList>
35 #include <QDomDocument>
36 
37 extern "C"
38 {
39  typedef struct _AgProvider AgProvider;
40 }
41 
42 namespace Accounts
43 {
44 class Provider;
45 
46 typedef QList<Provider> ProviderList;
47 
48 class ACCOUNTS_EXPORT Provider
49 {
50 public:
51  Provider();
52  Provider(const Provider &other);
53  Provider &operator=(const Provider &other);
54  ~Provider();
55 
56  bool isValid() const;
57 
58  QString name() const;
59  QString displayName() const;
60  QString description() const;
61  QString pluginName() const;
62  QString trCatalog() const;
63  QString iconName() const;
64  QString domainsRegExp() const;
65  bool isSingleAccount() const;
66  bool hasTag(const QString &tag) const;
67  QSet<QString> tags() const;
68  const QDomDocument domDocument() const;
69 
70  friend inline bool operator==(const Accounts::Provider &p1,
71  const Accounts::Provider &p2) {
72  return p1.m_provider == p2.m_provider || p1.name() == p2.name();
73  }
74 
75 private:
76  // \cond
77  friend class Manager;
78  Provider(AgProvider *provider, ReferenceMode mode = AddReference);
79  AgProvider *provider() const;
80  AgProvider *m_provider;
81  mutable QSet<QString> *m_tags;
82  // \endcond
83 };
84 
85 } //namespace Accounts
86 
87 #endif // ACCOUNTS_PROVIDER_H
Manager of accounts, services and providers.
Definition: manager.h:52
Representation of an account provider.
Definition: provider.h:49
QString name() const
Get the name of the provider.
Definition: provider.cpp:112